package com.jn.algorithm.拼多多.q2021.question1;

import java.util.Scanner;

/**
 * @author 江南大学1033190417
 * @date 2022/5/19 21:34
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        if (N <= 9) {
            System.out.println(N);
            return;
        }
        int carry = 1;
        int sum = 0;
        for (int i = 9; i >= 0; i--) {
            if (N < 9 && N <= i) {
                System.out.println(carry * N + sum);
                return;
            }
            N -= i;
            sum += i * carry;
            carry *= 10;
        }
        System.out.println(-1);
    }
}
